<style type="text/css">
	span.list-conr{
		color:#575757;
		font-size:0.417rem;
	}
	p.extend-remark{
		text-indent:0;
		font-size:0.333rem;
		color:#575757;
		margin-top:0;
	}
</style>
<script type="text/javascript">
(function(){
	var param = stateman.current.param;
	var client = {};

	for (var k in param){
		var key = decodeURIComponent(k);
		var val = decodeURIComponent(param[k]);
		client[key] = val;
	}

	var keyType = client.safe_mode;
	var tkipAes = client.encryption;
	var bssid = client.bssid;

	$("#ClientSsid").text(client.ssid);
	if (keyType == "OPEN"){
		$("#SetPwd").hide();
	}else{
		$("#SetPwd").show();
	}

	function errHandle(code)
	{
		switch(code){
		case E_NONE:
			break;
		case E_WISPSSIDBLANK:
			showNote(errStr.ssidEmpty);
			break;
		case E_WISPSSIDLEN:
			showNote(errStr.ssidLength);
			break;
		case E_WISPSSIDILLEGAL:
			showNote(errStr.ssidInclSpeChar);
			break;
		case E_WISPPSKPWBLANK:
			showNote(errStr.wifiPwdEmpty);
			break;
		case E_WISPPSKPWLEN:
			showNote(errStr.wifiPwdLengthErr);
			break;
		case E_WISPPSKPWILLEGAL:
			showNote(errStr.ssidPwdInclSpeChar);
			break;
		case E_WISPNOTFOUND:
			showNote(errStr.wispNotFound);
			break;
		default:
			showNote(errStr.unknownErr + code);
			break;
		}

		return true;
	}

	$("#Save").click(function(){
		var data = {};
		var para = {};
		para.wisp = {};
		para.wisp.config = data;
		data.enable = "1";
		data.band = client.band;
		data.bssid = bssid;
		data.ssid = client.ssid;
		data.password = $("#ExtendPwd").val();
		data.safe_mode = keyType;
		data.encryption = tkipAes;
		showConfirm(label.openExtend, function(choose){
			if (choose){
				showLoading(label.saveOpenExtend);
				apiSet(para, function(ret){
					var code = ret[ERR_CODE];
					if (E_NONE == code){
						$.setTimeout(function(){
							closeLoading();
							stateman.go("wisp");
						}, ROUTER.time.reboot);
					}else{
						errHandle(code);
						closeLoading();
					}
				});
			}
		});
	});

})();
</script>
<div class="head-con">
	<a href="#/apList" class="head-btn-l"><i class="head-btn icon icon_back"></i></a>
	<h1 class="head-title">{%label.confirmExtend%}</h1>
</div>
<div class="set-con below-head">
	<ul class="blank-bg"></ul>
	<ul class="set-con">
		<label class="desc-lbl">{%label.networkName%}</label>
		<li class="text-con">
			<span class="list-conr" id="ClientSsid"></span>
		</li>
	</ul>
	<ul class="set-con hidden" id="SetPwd">
		<label class="desc-lbl">{%label.networkPwd%}</label>
		<li class="text-con">
			<input id="ExtendPwd" class="text hover" maxLength="64" value="" />
		</li>
	</ul>
	<ul class="blank-bg"></ul>
	<div class="err-note hidden">
		<i class="err-icon icon_remind_line"></i>
		<p class="note-str"></p>
	</div>
	<div class="btn-con">
		<input id="Save" class="btn" type="button" value="{%btn.startExtend%}" />
	</div>
</div>